{% import "macro.html.twig" as web_macro %}
{% set quality = "" %}

{% set fileShowUrl = path('open_course_manage_file_show',{id:courseSet.id,fileId:uploadFile.id}) %}
{% set convertUrl = path('open_course_manage_file_convert',{id:courseSet.id, fileId:uploadFile.id})%}

<tr id="upload-file-tr-{{uploadFile.id}}" data-role="item" data-convertHash="{{uploadFile.convertHash}}">
  <td><input value="{{uploadFile.id}}" type="checkbox" data-role="batch-item" ></td>
  <td>
    <a class="link-dark" href="{{ fileShowUrl }}" target="_blank" rel="tooltip" title data-original-title="{{ uploadFile.filename }}"  >
      {% if uploadFile.storage == 'cloud' %}
        <i class="glyphicon glyphicon-cloud color-gray" title="{{'course.course_files.cloud_file'|trans}}"></i>
      {% endif %}
      {{ uploadFile.filename|sub_text(30) }}
    </a>
    {% if setting('developer.debug') and uploadFile.storage == 'cloud' and uploadFile.type in ['video', 'ppt', 'document'] %}
      <a href="javascript:;" data-url="{{ convertUrl }}" class="convert-file-btn ml5">{{'course.course_files.reconvert_btn'|trans}}</a>
    {% endif %}
    <br>
  </td>
  <td>
    {{ dict_text('fileType', uploadFile.type) }}
  </td>
  <td>{{ web_macro.bytesToSize(uploadFile.fileSize) }}</td>
  <td>
    {% set fileQuotes = filesQuote[uploadFile.id]|default(null) %}
    {# {% if 'courselesson' in fileQuotes or 'opencourselesson' in fileQuotes %}
      <span class="label label-success tip">{{'任务'|trans}}</span>
    {% endif %}

    {% if 'coursetask' in fileQuotes %}
      <span class="label label-success tip">{{'任务'|trans}}</span>
    {% endif %}

    {% if 'coursematerial' in fileQuotes or 'opencoursematerial' in fileQuotes %}
      <span class="label label-success tip">{{'资料'|trans}}</span>
    {% endif %}

    {% if not fileQuotes %}
      <span class="label label-default tip">{{'未使用'|trans}}</span>
    {% endif %} #}

    {# 暂时只需要区分使用和未使用 #}
    {% if fileQuotes %}
      <span class="label label-success tip">{{'course.course_files.use_status.using'|trans}}</span>
    {% else %}
      <span class="label label-default tip">{{'course.course_files.use_status.unused'|trans}}</span>
    {% endif %}
  </td>
  <td>
    <span class="text-sm">{{ web_macro.user_link(users[uploadFile.updatedUserId]|default(null)) }}</span>
    <br>
    <span class="color-gray text-sm">
      {% if not uploadFile.updatedTime %}
        {{ uploadFile.createdTime|date('Y-n-d H:i')}}
      {% else %}
        {{ uploadFile.updatedTime|date('Y-n-d H:i')}}
      {% endif %}
    </span>
  </td>
  <td>
    {% if uploadFile.storage == "cloud" and uploadFile.type == 'video' %}
      {% set goto = path('open_course_manage_files', {id:courseSet.id}) %}
      
      <a href="{{ path('media_subtitle_manage', {mediaId:uploadFile.id, goto:goto}) }}">{{'course.course_files.subtitle_manage_btn'|trans}}</a>
    {% endif %}
  </td>

</tr>
